package com.order.mapper;

import com.order.entity.Comments;
import com.order.vo.CommentsVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentsMapper {

    @Insert("insert into comments(product_id, user_id, username, comments) VALUES (#{productId}, #{userId}, #{username}, #{comments})")
    void insert(Comments comments);

    @Select("select username, comments from comments where product_id = #{productId}")
    List<CommentsVo> getByProductId(Long productId);



}
